{% extends "zerver/emails/email_base_messages.html" %}

{% block content %}
    {% if show_message_content %}
    {% if hot_conversations %}
        {% for convo in hot_conversations %}
        <div class='messages'>
            {% with recipient_block=convo.first_few_messages %}
                <div class='hot_convo_recipient_block'>
                    <div class='hot_convo_recipient_header'>{{ recipient_block.header.html|safe }}</div>
                    <div class='hot_convo_message_content'>
                        {% for sender_block in recipient_block.senders %}
                            {% for message_block in sender_block.content %}
                            <div class='hot_convo_message_content_block'>
                                {{ message_block.html|safe }}
                            </div>
                            {% endfor %}
                        {% endfor %}
                    </div>
                </div>
                {% if convo.count > 0 %}<p class="digest_paragraph">+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list(4) }}.</p>{% endif %}
            {% endwith %}
        </div>
        {% endfor %}
    {% endif %}

    {% if new_channels.html %}
    <p class="digest_paragraph"><b>{% trans %}New channels{% endtrans %}</b></p>

    <p class="digest_paragraph">{{ new_channels.html|display_list(1000)|safe }}.</p>
    {% endif %}
    {% else %}
    <p class="digest_paragraph">
        {% if new_messages_count > 0 and new_streams_count > 0 %}
            {% trans %}You have {{ new_messages_count }} new messages, and there are {{ new_streams_count }} new channels in <a href="{{ realm_url }}">{{ realm_name }}</a>.{% endtrans %}
        {% elif new_messages_count > 0 and new_streams_count == 0 %}
            {% trans %}You have {{ new_messages_count }} new messages in <a href="{{ realm_url }}">{{ realm_name }}</a>.{% endtrans %}
        {% else  %}
            {% trans %}There are {{ new_streams_count }} new channels in <a href="{{ realm_url }}">{{ realm_name }}</a>.{% endtrans %}
        {% endif %}
    </p>
    <p class="digest_paragraph">
        {% if message_content_disabled_by_realm %}
        {% trans help_url=realm_url + "/help/hide-message-content-in-emails" %}This email does not include message content because your organization <a class="content_disabled_help_link" href="{{ help_url }}">hides message content</a> in email notifications.{% endtrans %}
        {% elif message_content_disabled_by_user %}
        {% trans help_url=realm_url + "/help/email-notifications#hide-message-content" %}This email does not include message content because you have chosen to <a class="content_disabled_help_link" href="{{ help_url }}">hide message content</a> in email notifications.{% endtrans %}
        {% endif %}
    </p>
    {% endif %}
    <p class="digest_paragraph">{% trans %}<a href="{{ realm_url }}">Log in</a> to Zulip to catch up.{% endtrans %}</p>
{% endblock %}

{% block manage_preferences %}
<p class="digest_paragraph">
    <a href="{{ realm_url }}/#settings/notifications">{% trans %}Manage email preferences{% endtrans %}</a> |
    <a href="{{ unsubscribe_link }}">{% trans %}Unsubscribe from digest emails{% endtrans %}</a>
</p>
{% endblock %}
